#define DEBUG
#include <cstdio>
#include <cstring>
#define MAXN 1000000

using namespace std;

void sort(int *sa, int *rank, int *tp, int n, int size) {
  static int bucket[MAXN+1];
  for (int i=0; i<=size; i++) {
    bucket[i]=0;
  }
  for (int i=1; i<=n; i++) {
    bucket[rank[i]]++;
  }
  for (int i=1; i<=size; i++) {
    bucket[i] += bucket[i-1];
  }
  for (int i=n; i>0; i--) {
    sa[bucket[rank[tp[i]]]--] = tp[i];
  }
}

void makeSA(char *str, int n, int *sa, int *rank) {
  int size=256; //of different value
  static int tp[MAXN+1];
  for (int i=0; i<n; i++) {
    rank[i+1] = str[i];
    tp[i+1] = i+1;
  }
  sort(sa, rank, tp, n, size);
  
  for (int len=1, cnt=0; cnt<n; size=cnt, len<<=1) {
    cnt=0;
    for (int i=n-len+1; i<=n; i++) {
      tp[++cnt]=i;
    }
    for (int i=1; i<=n; i++) {
      if (sa[i]>len) {
	tp[++cnt] = sa[i]-len;
      }
    }
    sort(sa, rank, tp, n, size);
    memcpy(tp, rank, sizeof(tp));
    rank[sa[1]]=cnt=1;
    for (int i=2; i<=n; i++) {
      rank[sa[i]] = (tp[sa[i-1]]==tp[sa[i]] && tp[sa[i-1]+len]==tp[sa[i]+len]) ? cnt : ++cnt;
    }
  }
}

int main() {
#ifdef DEBUG
  freopen("p3809.in", "r", stdin);
  freopen("p3809.out", "w", stdout);
#endif

  char str[MAXN+1];
  scanf("%s", str);
  int n=strlen(str);

  static int sa[MAXN+1], rank[MAXN+1];
  makeSA(str, n, sa, rank);

  for (int i=1; i<=n; i++) {
    printf("%d ", sa[i]);
  }

  fcloseall();
  return 0;
}
